import { createApp } from "vue";
import App from "./App.vue";
import router from "./router";

import { initGlobalState, registerMicroApps, start } from "qiankun";
import store from "./store";

createApp(App).use(router).use(store).mount("#app");

registerMicroApps([
  {
    name: "appChild01",
    entry: "//localhost:7510",
    container: "#container",
    activeRule: "/child01",
    props: {
      router,
      store,
    },
  },
]);

// // 初始化 state
// const actions = initGlobalState({
//   open: true,
// });

// actions.onGlobalStateChange((state, prev) => {
//   // state: 变更后的状态; prev 变更前的状态
//   console.log(state, prev);
// });
// setTimeout(() => {
//   actions.setGlobalState({
//     open: false,
//   });
// }, 5000);
// actions.offGlobalStateChange();

start();
